home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wayzata's Best of Shareware PC/Windows 1
/
Wayzata's Best of Shareware for PC-Windows - Release 1 - Wayzata Technology (1993).iso
/
mac
/
DOS
/
GRAPHICS
/
LISS151
/
FIELD.H
< prev
next >
Wrap
C/C++ Source or Header
|
1992-03-10
|
4KB
|
118 lines
/* *****************
FIELD.H
field input defines and functions
Program originally written by Dan Farmer using algorithms from
Clifford Pickover. Converted from QuickBasic to C by Aaron C. Caba.
See Scientific American January 1991 and Omni February 1990 for
excellent examples by Pickover.
History:
Version 1.5:
03/10/92 ACC Move #includes from field.c to field.h
Version 1.4:
02/11/92 ACC Major rearangement of all code:
move all field manipulation prototypes to FIELD.H
clean up header files so only necessary stuff is in each
02/06/92 ACC split field input functions off from LISSAJOU.C
*/
/*=========================== Defined constants ========================*/
#ifndef _FIELD
#define _FIELD
#define CHAR_BOX_X 8 /* size of the graphics- */
#define CHAR_BOX_Y 10 /* character boxes */
#define MESSAGE_Y_POS 32 /* text Y pos of displayed messages */
#define FALSE 0 /* Handy return values */
#define TRUE !FALSE
#define NO_EXIT 0
#define EXIT -1
#define MAXFIELDS 15 /* Number of input fields */
#define MAX_FIELD_LEN 47 /* maximum length of a data field */
#define UP 0x48 /* scan codes of control characters */
#define DOWN 0x50
#define PGUP 0x49
#define PGDN 0x51
#define F10 0x44
#define ESC 0x1B
#define RETURN '\r'
#define BKSPC '\b'
#include <alloc.h>
#include <conio.h>
#include <ctype.h>
#include <graphics.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "error_fn.h" /* error handling routine */
#include "defines.h" /* global defines ie MAXFIELDS */
/*=============================== enum's ===============================*/
/* the different input fields */
enum {MAIN_RADIUS, A, B,
EXPONENT_X, EXPONENT_Y, EXPONENT_Z,
SPH_RADIUS, SPHERES, AXIS, ALGO, ROTATE,
FILE_NAME, NUMCOLORS, COLOR_NAME, ALGO_EQN};
enum {INTEGER, DECIMAL, XYZ, SIGNED_INTEGER, ALPHA};
/*============================ Field Structure ========================*/
/* structure field_type. Holds: label -- name of the field
len -- length of data field
x -- character x position of field label
y -- character y position of field label
type -- type of data the field holds
*/
struct field_struct {
char label[18];
int len;
int x; int y;
int type;
};
/*========================== Function Prototypes =======================*/
void assign_default(char *data[]);
/* Process a control character from the keyboard. If backspace,
delete last character in 'data'
Return control character pressed */
char control_char(char ch, char *data, int *chcount);
/* Print all data fields */
void disp_data(char *data[]);
/* Print data from field 'n' in color 'color' */
void disp_field(int n, char *data, int color, int dy);
/* Print 'str' in bottom window */
void disp_message(char *str);
/* Print text at text coords (x,y) in color 'color' */
void disp_text(int x, int y, char *msg, int color);
/* Erase text for 'n' spaces at text position (x,y) */
void erase_text(int x, int y, int n);
/* Edit field # 'fieldnum', and put new string in 'data'
Return which control key was pressed */
int fieldinput(int fieldnum, char *data, char *msg, int dy);
/* Print "msg"+"(Y or N)" on bottom panel
Return TRUE for Y or FALSE for N */
int verify(char *msg);
#endif